package com.doubi.controller.api;

import com.doubi.model.sys.TSysDicChild;
import com.doubi.modelvo.sys.SysDicChildVo;
import com.doubi.service.SysDicService;
import com.doubi.utils.DataUtil;
import com.doubi.vo.AppUiModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
@CrossOrigin
@RequestMapping("Api/Dic")
@Api(value = "字典", tags = "字典模块")
public class ApiDicController {

    @Autowired
    public SysDicService sysDicService;

    @ApiOperation(value = "字典数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "parentCode", value = "父级标识", required = true, dataType = "string"),
    })
    @GetMapping("GetDicList")
    @ResponseBody
    public AppUiModel<List<SysDicChildVo>> getDicList(String parentCode) {
        return sysDicService.getChildByParentCode(parentCode);
    }

}
